package com.dlc.beijingrfid.activity;

import android.os.Bundle;
import android.widget.TextView;
import butterknife.BindView;
import com.dlc.commonlibrary.widget.TitleBar;
import com.dlc.beijingrfid.R;
import com.dlc.beijingrfid.base.BaseActivity;
import com.dlc.beijingrfid.net.bean.NoticeReadBean;
import com.dlc.beijingrfid.net.exception.ErrorMsgException;
import com.dlc.beijingrfid.net.protocol.UserProto;
import com.dlc.beijingrfid.net.protocol.base.HttpProtocol;

/**
 * Created by Administrator on 2017/7/19 0019.
 */

public class MessageDetailActivity extends BaseActivity {

    @BindView(R.id.titleBar)
    TitleBar mTitleBar;
    @BindView(R.id.problem)
    TextView mProblem;
    @BindView(R.id.reply)
    TextView mReply;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mTitleBar.leftExit(this);
        String id = getIntent().getStringExtra("id");
        getData(id);
        readMsg(id);
    }

    @Override
    protected int getLayoutID() {
        return R.layout.activity_message_details;
    }

    private void getData(String id){

    }

    public void readMsg(String id) {
        showLoadingDialog();
        UserProto.get().readMsg(id, new HttpProtocol.Callback<NoticeReadBean>() {
            @Override
            public void onSuccess(NoticeReadBean simpleBean) {
                dismissLoadingDialog();
                mProblem.setText(simpleBean.data.title);
                mReply.setText(simpleBean.data.message);
            }

            @Override
            public void onFailed(int code, ErrorMsgException e) {
                dismissLoadingDialog();
                showOneToast(e.getMessage());
            }
        });
    }
}
